home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
WindowSize
/
fenetre.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
2KB
|
113 lines
#import "fenetre.h"
@implementation fenetre
NXRect frame;
int temp_x, temp_y, vieux_cadre_x, vieux_cadre_y;
int vieux_cadre_h, vieux_cadre_l;
NXRect cadre;
- appDidInit:sender
{
[mafenetre makeKeyAndOrderFront:self];
[mafenetre getFrame:&frame];
[hori setIntValue: NX_X(&frame)];
[verti setIntValue: NX_Y(&frame)];
[s_hori setIntValue: NX_WIDTH(&frame)];
[s_verti setIntValue: NX_HEIGHT(&frame)];
[action_faite setStringValue:"New Window"];
temp_x = NX_WIDTH(&frame);
temp_y = NX_HEIGHT(&frame);
return self;
}
- windowDidMove:sender;
{
[mafenetre getFrame:&frame];
/* Vieille méthode:
xOff = frame.origin.x;
yOff = frame.origin.y;
*/
[hori setIntValue: NX_X(&frame)];
[verti setIntValue: NX_Y(&frame)];
[action_faite setStringValue:"Moved"];
return self;
}
- windowDidResize:sender;
{
[mafenetre getFrame:&frame];
[ecran_texte getFrame:&cadre];
[s_hori setIntValue: NX_WIDTH(&frame)];
[s_verti setIntValue: NX_HEIGHT(&frame)];
[v_hori setIntValue: NX_HEIGHT(&cadre)];
[v_verti setIntValue: NX_WIDTH(&cadre)];
vieux_cadre_l = NX_WIDTH(&cadre);
vieux_cadre_h = NX_HEIGHT(&cadre);
if ((temp_x < NX_WIDTH(&frame)) & (temp_y < NX_WIDTH(&frame)))
[action_faite setStringValue:"Ajustment: Bigger..."];
if ((temp_x > NX_WIDTH(&frame)) & (temp_y > NX_HEIGHT(&frame)))
[action_faite setStringValue:"Ajustment: Smaller..."];
temp_x = NX_WIDTH(&frame);
temp_y = NX_HEIGHT(&frame);
/* [ecran_texte sizeTo : NX_WIDTH(&frame)-10 : NX_HEIGHT(&frame) - 5];
*/
return self;
}
- get_size:sender
{
[ecran_texte getFrame:&cadre];
[v_verti setIntValue: [ajuste_v intValue]];
[v_hori setIntValue: [ajuste_h intValue]];
NX_WIDTH(&cadre) = [ajuste_h intValue];
NX_HEIGHT(&cadre) = [ajuste_v intValue];
[ecran_texte sizeTo : NX_WIDTH(&cadre) : NX_HEIGHT(&cadre)];
[ecran_texte display];
[mafenetre display];
return self;
}
- windowDidBecomeKey:sender;
{
int bidon, prio;
static char son[] = {"wellcome.snd"};
prio = 5;
bidon = SNDPlaySoundfile(son,prio);
[action_faite setStringValue:"Welcome Back!"];
return self;
}
@end